package com.fy.fyzf.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.zhouwei.library.CustomPopWindow;
import com.fy.fyzf.R;

public class HousingSharePopwindow  {
    private Context mContext;
    public HousingSharePopwindow(Context context) {
        mContext = context;
    }

    CustomPopWindow customPopWindow;
    View popView;
    public void show(View v){
        popView = LayoutInflater.from(mContext).inflate(R.layout.popwindow_housing_share, null, false);
         customPopWindow = new CustomPopWindow.PopupWindowBuilder(mContext).setView(popView)
                .size(ViewGroup.LayoutParams.MATCH_PARENT, 500)
                .setFocusable(true)
                .setOutsideTouchable(false)
                .enableBackgroundDark(true)
                .create()//创建PopupWindow
                .showAtLocation(v, Gravity.BOTTOM, 0, 0);

         popView.findViewById(R.id.tv_cancel).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 customPopWindow.dissmiss();
             }
         });
    }

    public View getView(int viewId){
        return popView.findViewById(viewId);
    }

    public void onDismiss(){
        if (null != customPopWindow) {
            customPopWindow.dissmiss();
        }
    }
}
